<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>공통코드 추가</title>
	<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
	<script type="text/javascript" src="/inc/css/common.js"></script>
	
	<script language="javascript">
	
	function saveCommonCode() {
	
		var group_code_nm = form.group_code_nm.value;
		var checkedUseyn = form.checkedUseyn.value;

		if(group_code_nm == ""){
			alert("대표코드명을 입력하세요.");
			return false;
		}
	
		if(checkedUseyn == ""){
			alert("사용여부를 선택하세요.");
			return false;
		}
		
		form.action="saveCommonCode.action";
		window.close();		
  		opener.alert("완료되었습니다.");
   		opener.location.reload();
		
	}
	
	function addSubCommonCode() {
	
		var group_cd = form.group_cd.value;
		var group_code_nm = form.group_code_nm.value;
		group_code_nm  = encodeURI(group_code_nm);
		var checkedUseyn = form.checkedUseyn.value;

		if(group_code_nm == ""){
			alert("대표코드명을 입력하세요.");
			return false;
		}
	
		if(checkedUseyn == ""){
			alert("사용여부를 선택하세요.");
			return false;
		}
		
		width = 567;
		height = 216;
		
		var x = 0 , y = 0;
		
		if (document.layers) { 
			x	= screen.width / 2 - outerWidth / 2; 
			y 	= screen.height / 2 - outerHeight / 2; 
		} else { 
			x 	= screen.width / 2 - document.body.offsetWidth / 2; 
			y 	= -75 + screen.height / 2 - document.body.offsetHeight / 2; 
		}
		
		scrollOption = "Yes";
		window.open("addSubCommonCode.action?group_cd="+group_cd+"&group_code_nm="+group_code_nm+"&checkedUseyn="+checkedUseyn,	"popup2",	"left="	+ x + ",top=" + y	+ ",width="	+ width + ",height=" + height	+ ",ScrollBars="+scrollOption+",status=yes,menubar=no");
		
		return false;
				
	}
	
</script>
</head>
<body>
	<s:form name="form" theme="simple" >
		<div id="popup_550se_top" ></div>
		<div id="popup_550se_bg">
			<table class="pop550se_Tbl">
			<tr>
				<th>대표코드명</th>
				<td>
					<s:textfield name="group_code_nm" cssClass="input_120se"/>
				</td>
				<th>사용여부</th>
				<td>
					<s:select name="checkedUseyn"   headerKey="" headerValue="::선택하세요::" list="#{'Y':'Y','N':'N'}" cssClass="combobox120se"/>
					<input type="hidden" name="group_cd" value="<s:property value="group_cd"/>"/>		
				</td>
			</tr>	
			</table>	
			
		<div id="popup_btn"><s:submit type="image" src="/images/btn_save.gif" onclick="saveCommonCode();"/><s:submit value="하위코드추가" onclick="return addSubCommonCode()"/></div>
		</div>

		<!---------------Bottom : STR----------->
		<div id="popup_550se_bottom"><s:submit type="image" src="/images/pop_btn_close.gif" onclick="window.close();"/></div>
		<!---------------Bottom : END----------->
	</s:form>
</body>
</html>
